﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Collections.Specialized;
using System.Text;
using SCRUM.Core.BusinessObjects;
using SCRUM.Core.DAO;
using SCRUM.Core.MembershipProviders;
using System.Web.UI.WebControls;

/// <summary>
/// Scrum web control used to obtain information from text:
///  * text
///  * date
///  * number
/// </summary>
public abstract class ScrumInput : ScrumWebControl
{
    /// <summary>
    /// Specifies CSS style for Label which is bound to TexBox with invalid input
    /// </summary>
    //protected const string CSSLabelInError = "red";

    /// <summary>
    /// Specifies CSS style for TexBox with invalid content
    /// </summary>
    //protected const string CSSInputInError = "BadInputTextBox";

    public const string ReadOnlySkinID = "ReadOnlySkinID";

    /// <summary>
    /// Gets or sets the text.
    /// </summary>
    /// <value>The text.</value>
    public string Text
    {
        get { return (this.webControl as TextBox).Text;  }
        set { (this.webControl as TextBox).Text = value; }
    }

    /// <summary>
    /// Gets or sets a value indicating whether this <see cref="ScrumWebControl"/> 
    /// is readonly.
    /// </summary>
    /// <value><c>true</c> if enabled; otherwise, <c>false</c>.</value>
    public override bool ReadOnly 
    {
        get { return base.ReadOnly; }
        set 
        {
            //webControl.SkinID = ReadOnlySkinID;
            if (value)
            {
                webControl.CssClass = ReadOnlySkinID;
            }
            (this.webControl as TextBox).ReadOnly = value;
            base.ReadOnly = value;
        } 
    }

    /// <summary>
    /// validation group where control belongs
    /// </summary>
    protected string validationGroup;

    /// <summary>
    /// Gets or sets the validation group for input
    /// </summary>
    /// <value>The validation group.</value>
    public abstract string ValidationGroup{ get; set; }

    /// <summary>
    /// Sets the max length of textbox
    /// </summary>
    /// <value>The length of the max.</value>
    public int MaxLength 
    {
        set
        {
            (this.webControl as TextBox).MaxLength = value;
        }
    }

}


